import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/components/HaveMenu.vue'
import PersonalProjects from '../views/Personalprojects'
import AboutMe from '../views/AboutMe'
import LearningRecord from '../views/LearningRecord'
import Conclusion from '../views/Conclusion'
import Personal from '../views/Personal'

// 登录和注册
import Login from '../views/Login'
import Reg from '../views/Reg'

// 后台管理路由
import AdminLayout from '@/components/admin/Layout.vue'
import AdminHome from "../views/admin/Home";
import AdminQuotes from "../views/admin/Quotes";
import AdminSwiper from "../views/admin/Swiper";
import AdminUser from "../views/admin/User";
import AdminAdmin from "../views/admin/Admin";
import AdminProductImage from "../views/admin/ProductImage";
import AdminProductTag from "../views/admin/ProductTag";
Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: PersonalProjects
      },
      {
        path: 'aboutMe',
        component: AboutMe
      },
      {
        path: 'learning',
        component: LearningRecord
      },
      {
        path: 'conclusion',
        component: Conclusion
      },
      {
        path: 'personal',
        component: Personal
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/reg',
    component: Reg
  },
  {
    path:'/admin',
    component: AdminLayout,
    children: [
      {
        path: 'personalWork',
        component: AdminHome
      },
      {
        path: 'quotes',
        component: AdminQuotes
      },
      {
        path: 'swiper',
        component: AdminSwiper
      },
      {
        path: 'user',
        component: AdminUser
      },
      {
        path: 'admin',
        component: AdminAdmin
      },
      {
        path: 'productImage',
        component: AdminProductImage
      },
      {
        path: 'productTag',
        component: AdminProductTag
      },
    ]
  }
]

const router = new VueRouter({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes
})

export default router
